home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / sbprolog / amiga / builtin2.zoo / init_branch.c < prev    next >
C/C++ Source or Header  |  1988-08-15  |  6KB  |  194 lines

  1. /************************************************************************
  2. *                                    *
  3. * The SB-Prolog System                            *
  4. * Copyright SUNY at Stony Brook, 1986; University of Arizona, 1987    *
  5. *                                    *
  6. ************************************************************************/
  7.  
  8. /*-----------------------------------------------------------------
  9. SB-Prolog is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY.  No author or distributor
  11. accepts responsibility to anyone for the consequences of using it
  12. or for whether it serves any particular purpose or works at all,
  13. unless he says so in writing.  Refer to the SB-Prolog General Public
  14. License for full details.
  15.  
  16. Everyone is granted permission to copy, modify and redistribute
  17. SB-Prolog, but only under the conditions described in the
  18. SB-Prolog General Public License.   A copy of this license is
  19. supposed to have been given to you along with SB-Prolog so you
  20. can know your rights and responsibilities.  It should be in a
  21. file named COPYING.  Among other things, the copyright notice
  22. and this notice must be preserved on all copies. 
  23. ------------------------------------------------------------------ */
  24.  
  25. /* init_branch.c */
  26.  
  27. #include "builtin.h"
  28.  
  29. extern int b_0();
  30. extern int b_1();
  31. extern int b_NAME0();
  32. extern int b_BLDATOM();
  33. extern int b_STLOOKUP();
  34. extern int b_RESET ();
  35. extern int b_REWRITE ();
  36. extern int b_GET0 ();
  37. extern int b_GET  ();
  38. extern int b_SKIP ();
  39. extern int b_READ ();
  40. extern int b_READNAME ();
  41. extern int b_CLOSE ();
  42. extern int b_PUT ();
  43. extern int b_TAB ();
  44. extern int b_NL  ();
  45. extern int b_FILEERRORS ();
  46. extern int b_NOFILEERRORS ();
  47. extern int b_ALLOC_BUFF ();
  48. extern int b_BUFF_CODE ();
  49. extern int b_TRIMBUFF ();
  50. extern int b_WRITE4 ();
  51. extern int b_ARITH ();
  52. extern int b_FLOATC ();
  53. extern int b_REAL ();
  54. extern int b_FLOOR0 ();
  55. extern int b_VAR ();
  56. extern int b_NONVAR ();
  57. extern int b_ATOM ();
  58. extern int b_INTEGER ();
  59. extern int b_ATOMIC ();
  60. extern int b_ARITY ();
  61. extern int b_STATS ();
  62. extern int b_DBREF ();
  63. extern int b_CPUTIME ();
  64. extern int b_COMPARE ();
  65. extern int b_SAVE ();
  66. extern int b_RESTORE ();
  67. extern int b_ARG0 ();
  68. extern int b_FUNCTOR0 ();
  69. extern int b_SYSTEM0 ();
  70. extern int b_SYSCALL ();
  71. extern int b_BROCALL ();
  72. extern int b_ERRNO ();
  73. extern int b_BLDSTR  ();
  74. extern int b_MKSTR  ();
  75. extern int b_TERMREP ();
  76. extern int b_STRUCTURE ();
  77. extern int b_WRITEQNAME ();
  78. extern int b_WRITENAME ();
  79. extern int b_CALL ();
  80. extern int b_LOAD ();
  81. extern int b_SEE();
  82. extern int b_SEEING();
  83. extern int b_SEEN();
  84. extern int b_TELL();
  85. extern int b_TELLING();
  86. extern int b_TOLD();
  87. extern int b_STATISTICS0();
  88. extern int b_STATISTICS();
  89. extern int b_SYMTYPE();
  90. extern int b_HASHVAL();
  91. extern int b_TRACE();
  92. extern int b_PILTRACE();
  93. extern int b_UNTRACE();
  94. extern int b_FLAGS();
  95. extern int b_SUBSTRING();
  96. extern int b_SUBNUMBER();
  97. extern int b_SUBDELIM();
  98. extern int b_CONLENGTH();
  99. /* CURSES: add this instruction 
  100. extern int b_CURSES(); */
  101.  
  102. extern int b_NEXT_TOKEN();
  103.  
  104. #define set_b_inst(b_inst, routine) \
  105.     branch_table[b_inst] = routine
  106.  
  107. int (*branch_table[256])();
  108.  
  109. b_unused()
  110. {
  111.     printf("Builtin #%d is not implemented.\n", oprnd1);
  112.     exit(111);
  113. }
  114.  
  115. init_branch_table()
  116. {
  117.     int i;
  118.  
  119.     for (i=0; i<256; i++) set_b_inst( i, b_unused);
  120.     set_b_inst ( VAR, b_VAR);
  121.     set_b_inst ( BUFF_CODE, b_BUFF_CODE);
  122.     set_b_inst ( TRIMBUFF, b_TRIMBUFF);
  123.     set_b_inst ( ALLOC_BUFF, b_ALLOC_BUFF);
  124.     set_b_inst ( SYSTEM0, b_SYSTEM0);
  125.     set_b_inst ( SYSCALL, b_SYSCALL);
  126.     set_b_inst ( BROCALL, b_BROCALL);
  127.     set_b_inst ( ERRNO, b_ERRNO);
  128.     set_b_inst ( NONVAR, b_NONVAR);
  129.     set_b_inst ( TERMREP, b_TERMREP);
  130.     set_b_inst ( WRITE4, b_WRITE4);
  131.     set_b_inst ( ARITH, b_ARITH);
  132.     set_b_inst ( FLOATC, b_FLOATC);
  133.     set_b_inst ( REAL, b_REAL);
  134.     set_b_inst ( FLOOR0, b_FLOOR0);
  135.     set_b_inst ( INTEGER, b_INTEGER);
  136.     set_b_inst ( ATOM, b_ATOM);
  137.     set_b_inst ( ATOMIC, b_ATOMIC );
  138.     set_b_inst ( ARITY, b_ARITY);
  139.     set_b_inst ( STRUCTURE, b_STRUCTURE);
  140.     set_b_inst ( DBREF, b_DBREF);
  141.     set_b_inst ( ARG0, b_ARG0);
  142.     set_b_inst ( FUNCTOR0, b_FUNCTOR0);
  143.     set_b_inst ( BLDSTR, b_BLDSTR);
  144.     set_b_inst ( MKSTR, b_MKSTR);
  145.     set_b_inst ( WRITEQNAME, b_WRITEQNAME);
  146.     set_b_inst ( FILEERRORS, b_FILEERRORS);
  147.     set_b_inst ( NOFILEERRORS, b_NOFILEERRORS);
  148.     set_b_inst ( PUT, b_PUT);
  149.     set_b_inst ( GET0, b_GET0);
  150.     set_b_inst ( GET, b_GET);
  151.     set_b_inst ( SKIP, b_SKIP);
  152.     set_b_inst ( TAB, b_TAB);
  153.     set_b_inst ( NL, b_NL);
  154.     set_b_inst ( READNAME, b_READNAME);
  155.     set_b_inst ( WRITENAME, b_WRITENAME);
  156.     set_b_inst ( STLOOKUP, b_STLOOKUP);
  157.     set_b_inst ( RESET, b_RESET);
  158.     set_b_inst ( REWRITE, b_REWRITE);
  159.     set_b_inst ( CLOSE, b_CLOSE);
  160.     set_b_inst ( 0, b_0);
  161.     set_b_inst ( 1, b_1);
  162.     set_b_inst ( NAME0, b_NAME0);
  163.     set_b_inst ( BLDATOM, b_BLDATOM);
  164.     set_b_inst ( CALL, b_CALL);
  165.     set_b_inst ( LOAD, b_LOAD);
  166.     set_b_inst ( SEE, b_SEE);
  167.     set_b_inst ( SEEING, b_SEEING);
  168.     set_b_inst ( SEEN, b_SEEN);
  169.     set_b_inst ( TELL, b_TELL);
  170.     set_b_inst ( TELLING, b_TELLING);
  171.     set_b_inst ( TOLD, b_TOLD);
  172.     set_b_inst ( CPUTIME, b_CPUTIME);
  173.     set_b_inst ( STATS, b_STATS);
  174.     set_b_inst ( COMPARE, b_COMPARE);
  175.     set_b_inst ( SAVE,  b_SAVE);
  176.     set_b_inst ( RESTORE, b_RESTORE);
  177.     set_b_inst ( STATISTICS0, b_STATISTICS0);
  178.     set_b_inst ( STATISTICS, b_STATISTICS);
  179.     set_b_inst ( SYMTYPE, b_SYMTYPE);
  180.     set_b_inst ( HASHVAL, b_HASHVAL);
  181.     set_b_inst ( TRACE, b_TRACE);
  182.     set_b_inst ( PILTRACE, b_PILTRACE);
  183.     set_b_inst ( UNTRACE, b_UNTRACE);
  184.     set_b_inst ( FLAGS, b_FLAGS);
  185.     set_b_inst ( SUBSTRING, b_SUBSTRING);
  186.     set_b_inst ( SUBNUMBER, b_SUBNUMBER);
  187.     set_b_inst ( SUBDELIM, b_SUBDELIM);
  188.     set_b_inst ( CONLENGTH, b_CONLENGTH);
  189. /* CURSES: add this instruction 
  190.     set_b_inst ( CURSES, b_CURSES); */
  191.  
  192.     set_b_inst ( NEXT_TOKEN, b_NEXT_TOKEN);
  193. }
  194.